/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.marlboroug.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;


@Entity
@Table(name = "Articles_by_authors")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Articlesbyauthors.findAll", query = "SELECT a FROM Articlesbyauthors a"),
    @NamedQuery(name = "Articlesbyauthors.findByIDarticlesbyauthors", query = "SELECT a FROM Articlesbyauthors a WHERE a.iDarticlesbyauthors = :iDarticlesbyauthors")})
public class Articlesbyauthors implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_articles_by_authors")
    private Long iDarticlesbyauthors;
    @JoinColumn(name = "id_authors", referencedColumnName = "ID_authors")
    @ManyToOne(optional = false)
    private Authors idAuthors;
    @JoinColumn(name = "id_articles", referencedColumnName = "ID_articles")
    @ManyToOne(optional = false)
    private Articles idArticles;

    public Articlesbyauthors() {
    }

    public Articlesbyauthors(Long iDarticlesbyauthors) {
        this.iDarticlesbyauthors = iDarticlesbyauthors;
    }

    public Long getIDarticlesbyauthors() {
        return iDarticlesbyauthors;
    }

    public void setIDarticlesbyauthors(Long iDarticlesbyauthors) {
        this.iDarticlesbyauthors = iDarticlesbyauthors;
    }

    public Authors getIdAuthors() {
        return idAuthors;
    }

    public void setIdAuthors(Authors idAuthors) {
        this.idAuthors = idAuthors;
    }

    public Articles getIdArticles() {
        return idArticles;
    }

    public void setIdArticles(Articles idArticles) {
        this.idArticles = idArticles;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iDarticlesbyauthors != null ? iDarticlesbyauthors.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Articlesbyauthors)) {
            return false;
        }
        Articlesbyauthors other = (Articlesbyauthors) object;
        if ((this.iDarticlesbyauthors == null && other.iDarticlesbyauthors != null) || (this.iDarticlesbyauthors != null && !this.iDarticlesbyauthors.equals(other.iDarticlesbyauthors))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.marlboroug.entity.Articlesbyauthors[ iDarticlesbyauthors=" + iDarticlesbyauthors + " ]";
    }
    
}
